package com.kongchengji.spider.station.start.startImpl;

import com.kongchengji.spider.station.constant.Constant;
import com.kongchengji.spider.station.process.processImpl.WangYiStationProcess;
import com.kongchengji.spider.station.start.StationInit;
import us.codecraft.webmagic.Spider;

public class AnalysisRequestInit implements StationInit {
    private Constant.Station station;
    public AnalysisRequestInit(Constant.Station station) {
        this.station = station;
    }


    /**
     *启动爬虫
     */
    @Override
    public void run() {
        WangYiStationProcess process = new WangYiStationProcess();
        process.setStation(station);
        Spider spider = Spider.create(process);
        spider.addUrl(station.getUrl());
        spider.run();
    }
}
